import java.util.ArrayList;
import java.util.Iterator;

public abstract class AbstractMatchStockValue {

	private ArrayList<StockValueObserver> observers = new ArrayList<StockValueObserver>();

	public void addObservers(StockValueObserver observer) {
		observers.add(observer);
	}

	public void delObservers(StockValueObserver observer) {
		observers.remove(observer);
	}

	public void notifyObservers(StockValueObserver buyer,
			StockValueObserver seller, int matchedQuantity) {
		Iterator<StockValueObserver> i = observers.iterator();
		while (i.hasNext()) {
			StockValueObserver observer = (StockValueObserver) i.next();
			observer.updateOrder(buyer, seller, matchedQuantity);
		}
	}
}
